n = int(input())
arr = [int(i) for i in input().split()]
count = 0
last = 'n'
for i in range(n):
if arr[i] == 0:
count +=1
last = 'n'
elif arr[i] == 1:
if last != 'c':
last = 'c'
else:
last = 'n'
count += 1
elif arr[i] == 2:
if last != 'g':
last = 'g'
else:
last = 'n'
count += 1
else:
if last == 'c':
last= 'g'
elif last == 'g':
last = 'c'
else:
last = 'n'
print(count)
#include <bits/stdc++.h>
#define fo(i, n) for(int i = 0; i < n; i++)
#define srt(arr) sort(arr.begin(),arr.end())
#define pb push_back
using namespace std;
#define ll long long
void mom(){
int n;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
int maxy =0;
vector<vector<int>>dp(n+1,vector<int>(3,0));
for(int i=1;i<=n;i++){
dp[i][0]= maxy;dp[i][1]= maxy; dp[i][2] = maxy;
if(a[i-1]==1 or a[i-1]==3){
dp[i][1] = max(dp[i-1][0],dp[i-1][2])+1;
maxy = max(dp[i][1],maxy);
}
if(a[i-1]==2 or a[i-1]==3){
dp[i][2] = max(dp[i-1][0],dp[i-1][1])+1;
maxy = max(dp[i][2],maxy);
}
}
cout<<n - maxy<<endl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int T;
T=1;
//cin>>T;
while(T--){
mom();
}
return 0;
}
165B - Burning Midnight Oil | 17A - Noldbach problem |
1350A - Orac and Factors | 1373A - Donut Shops |
26A - Almost Prime | 1656E - Equal Tree Sums |
1656B - Subtract Operation | 1656A - Good Pairs |
1367A - Short Substrings | 87A - Trains |
664A - Complicated GCD | 1635D - Infinite Set |
1462A - Favorite Sequence | 1445B - Elimination |
1656C - Make Equal With Mod | 567A - Lineland Mail |
1553A - Digits Sum | 1359B - New Theatre Square |
766A - Mahmoud and Longest Uncommon Subsequence | 701B - Cells Not Under Attack |
702A - Maximum Increase | 1656D - K-good |
1426A - Floor Number | 876A - Trip For Meal |
1326B - Maximums | 1635C - Differential Sorting |
961A - Tetris | 1635B - Avoid Local Maximums |
20A - BerOS file system | 1637A - Sorting Parts |